#pragma once
#include <Windows.h>
#include "Plugin.h"
#include "Command.h"
#include "Defines.h"

typedef IPlugin *(__stdcall *CreateInstanceFunc)(void);
typedef int(__stdcall *GetPluginInterfaceFunc)(void);

class PluginModule
{
public:
	PluginModule();
	HMODULE module;
	CreateInstanceFunc newInstance;
	IPlugin *Instance;
	char Name[PLUGINNAMELEN];
	ModuleInfo Info;
private:
};

class PluginManager
{
public:
	PluginManager();
	~PluginManager();
	bool HandleCommand(Command &newCommand);
	void Initialize();
	void Dispose();
	bool Load(char *path);
	bool Unload(char *path);
	void UnloadAll();
	void Toggle(char *path);
	int __stdcall GetVersion();
private:
	int moduleCount;
	PluginModule modules[MAXMODULES];
	bool Disposing;
};

extern PluginManager m_PluginManager;